<!DOCTYPE html>
<html>
<head>
	<!-- 公共页面 -->
	<#include "/admin/view/include/common.html">
	<!-- 公共页面 /-->
</head>
<body class="hold-transition skin-purple sidebar-mini">
    <div class="wrapper">
        <!-- 页面头部 -->
        <#include "/admin/view/include/header.html">
        <!-- 页面头部 /-->
        <!-- 导航侧栏 -->
        <#include "/admin/view/include/menu.html">
        <!-- 导航侧栏 /-->
        <!-- 内容区域 -->
        <div class="content-wrapper" id="contentDiv">
            <!-- 正文区域 -->
            <section class="content">
				<!-- .box-body -->
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">模板管理</h3>
                    </div>
                    <div class="box-body">
                        <!-- 数据表格 -->
                        <div class="table-box">
                            <!--工具栏-->
                            <div class="pull-left">
                                <div class="form-group form-inline">
                                    <div class="btn-group">
                                        <#if directory??><button type="button" class="btn btn-default" onclick='location.href="${base}/admin/template/add?directory=${directory}"'> 新增</button></#if>
                                        <button type="button" class="btn btn-default" id="refreshButton"><i class="fa fa-refresh"></i> 刷新</button>
                                        <#if directory??>
                                        <button type="button" class="btn btn-default" onclick='location.href="${base}/admin/template?directory=<#if directory?contains(",")>${directory?substring(0,directory?lastIndexOf(","))}</#if>"'><i class="fa fa-arrow-up"></i> 上级目录</button>
                                        </#if>
                                    </div>
                                </div>
                            </div>
                            <!--工具栏/-->
                            <!--数据列表-->
                            <table id="listTable" class="table table-bordered table-striped table-hover dataTable">
                                <thead>
                                    <tr>
                                        <th>名称</th>
	                                    <th>类型</th>
	                                    <th>大小</th>
	                                    <th>修改日期</th>
	                                    <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody id="listTr">
									<#list templateFiles as templateFile>
	                                <tr>
	                                    <td>
	                                    	<#if templateFile.isDirectory>
	                                    		<a href="${base}/admin/template?directory=<#if directory??>${directory},</#if>${templateFile.name}">${templateFile.name}</a>
	                                    	<#else>
	                                    		${templateFile.name}
                                            </#if>
	                                    </td>
	                                    <td>
	                                    	<#if templateFile.isDirectory>
	                                    		文件夹
	                                    	<#else>
	                                    		${templateFile.type}
                                            </#if>
	                                    </td>
	                                    <td>
	                                       <#if templateFile.isDirectory>
                                                  -
                                           <#else>
                                                ${templateFile.size}
                                           </#if>
	                                    </td>
	                                    <td>${templateFile.modifyDate}</td>
	                                    <td>
	                                    	<#if !templateFile.isDirectory>
	                                    		<#if templateFile.type=="js" || templateFile.type=="html" || templateFile.type=="css">
			                                        <button type="button" class="btn bg-olive btn-xs" onclick='location.href="${base}/admin/template/edit?fileName=${templateFile.name}&directory=${directory}"'>编辑</button>
                                                <#else>
			                                    	<button type="button" class="btn bg-olive btn-xs" onclick='window.open("${base}/admin/template/view?fileName=${templateFile.name}&directory=${directory}", "_blank")'>查看</button>
                                                </#if>
                                                <button type="button" class="btn bg-olive btn-xs" onclick='location.href="${base}/admin/template/delete?fileName=${templateFile.name}&directory=${directory}"'>删除</button>
                                            </#if>
	                                    </td>
	                                </tr>
                                    </#list>
                                </tbody>
                            </table>
                            <!--数据列表/-->
                        </div>
                        <!-- 数据表格 /-->
                    </div>
                    <!-- /.box-body -->
                </div>
            </section>
            <!-- 正文区域 /-->
        </div>
        <!-- 内容区域 /-->
        <!-- 底部导航 -->
        <#include "/admin/view/include/footer.html">
        <!-- 底部导航 /-->
    </div>
</body>
</html>
<!---->
<script>
 $(document).ready(function() {
     // 激活导航位置
     setSidebarActive("admin-template");
 });
</script>